import { createRouter, createWebHistory } from 'vue-router'
//createWebHashHistory  --  hash 模式链接有#。 http://localhost:5174/#/
import Index from '~/views/index.vue'
import Login from '~/views/login.vue'
import Goods from '~/views/goods/list.vue'
import LoginIndex from '~/views/login/index.vue'
import LoginRegister from '~/views/login/register.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/', name: 'index', component: Index,
      children:[
        { path: '/goods/list', name: 'goods', component: Goods, },
      ]
    },
    { path: '/login', name: 'login', component: Login,
      children:[
        { path: '', name: 'login_index', component: LoginIndex, },
        { path: '/login/register', name: 'register', component: LoginRegister, },
      ]
     },
  ],
})

export default router
